package com.pi.reservaCita2.controler;

import java.util.ArrayList;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.pi.reservaCita2.client.Getdata;
import com.pi.reservaCita2.client.GetdataAsync;
import com.pi.reservaCita2.client.citaButton;
import com.pi.reservaCita2.controler.Observable;
import com.pi.reservaCita2.controler.Observer;
//package com.pi.reservaCita2.server.*;
import com.pi.reservaCita2.server.citaData;

public class viewCita extends HorizontalPanel implements Observer{




	ArrayList<FlexTable> tablas=null;	
	String semana[]={"lunes"};
	Observable modelo =null;
	public viewCita()
	{
		tablas= new ArrayList<FlexTable>();	
		int u=8;
		for(int y=0;y<semana.length;y++)
		{
			FlexTable tab= new FlexTable();
			tab.getElement().setId("tab"+semana[y]);
			tablas.add(tab);
			tablas.get(y).setText(0,y, semana[y]);
			for(int p=0;p<u;p++)
			{
				citaButton but=new citaButton("obtenerCita");
				but.getElement().getStyle().setBackgroundColor("#feee00");

				tablas.get(y).setWidget(p+1,y, but);

			}

			this.add(tablas.get(y));
		}
		
	}
	public void render(ArrayList<String[]> data)
	{
		//se vuelve a dibujar la  tabla; 


	}

	@Override
	public void update(Observable model, Object hint) {

		// TODO Auto-generated method stub
		


	}

	public void getObservable()
	{
		
		GetObservableAsync obs = GWT.create(Observable.class);
		if(obs==null)
		{obs = GWT.create(Observable.class);		
		}
		AsyncCallback<Observable > callback = new AsyncCallback<Observable> (){

			@Override
			public void onFailure(Throwable caught) {
				// TODO Auto-generated method stub

			}

			@Override
			public void onSuccess(Observable result) {
				// TODO Auto-generated method stub
				
			}};

			obs.getaObss("",callback);

	}


}
